//
//  PersonRightController.m
//  soccer
//
//  Created by 上官千城 on 15/9/5.
//  Copyright (c) 2015年 上官千城. All rights reserved.
//

#import "PersonRightController.h"

@interface PersonRightController ()

@end

@implementation PersonRightController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 300) style:UITableViewStyleGrouped];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    
    UIButton *deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
    deleteButton.frame = CGRectMake(10, self.tableView.frame.origin.y + self.tableView.frame.size.height+30, WIDTH - 20, 30);
    deleteButton.backgroundColor = [UIColor orangeColor];
    [deleteButton setTitle:@"删除好友" forState:UIControlStateNormal];
    [deleteButton addTarget:self action:@selector(deleteButton) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:deleteButton];
}
-(void)deleteButton
{
    NSLog(@"delete");
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellInfo = @"settingCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellInfo];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellInfo];
        
    }
    NSMutableArray *array = [NSMutableArray arrayWithObjects:@"设置备注",@"转发名片",@"屏蔽此人",@"举报", nil];
    cell.textLabel.text = [array objectAtIndex:indexPath.row];
     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    if (indexPath.row == 2) {
        UISwitch *Shield = [[UISwitch alloc]initWithFrame:CGRectMake(WIDTH - 70, 5, 0, 0)];
        [Shield setOn:YES animated:YES];
        [Shield addTarget:self action:@selector(shieldButton) forControlEvents:UIControlEventValueChanged];
        [cell addSubview:Shield];
        cell.accessoryType = UITableViewCellAccessoryNone;
//        //点击Cell无色
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    //点击Cell无色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
   
    return cell;
}

-(void)shieldButton
{
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        //备注
        RemarksController *view = [[RemarksController alloc]init];
        [self.navigationController pushViewController:view animated:YES];
        
    }
    
    if (indexPath.row == 3) {
        //举报
        ReportController *view = [[ReportController alloc]init];
        [self.navigationController pushViewController:view animated:YES];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
